function reloadValidateCodeNotlogin(){
	$("#validationAreaNotlogin").html("");
	$("#validationAreaNotlogin").html('<img alt="验证码" src="'+ROOTPATH+'/validateCode.aspx?a='+UUID.prototype.createUUID()+'" style="width: 60px;height: 20px; vertical-align:middle;">');
}
function reloadValidateCodeNotlogin2(){
	$("#validationAreaNotlogin2").html("");
	$("#validationAreaNotlogin2").html('<img alt="验证码" src="'+ROOTPATH+'/validateCode.aspx?a='+UUID.prototype.createUUID()+'" style="width: 60px;height: 20px; vertical-align:middle;">');
}
function reloadValidateCodeNotlogin3(){
	$("#validationAreaNotlogin3").html("");
	$("#validationAreaNotlogin3").html('<img alt="验证码" src="'+ROOTPATH+'/validateCode.aspx?a='+UUID.prototype.createUUID()+'" style="width: 60px;height: 20px; vertical-align:middle;">');
}
function notFoundLogin(){
	reloadValidateCodeNotlogin();
	$("#notfoundLogin").css("display","inherit");
	$("#notfoundRegister").css("display","none");
	$("#notfoundLookpassword").css("display","none");
}
function notFoundRegister(){
	reloadValidateCodeNotlogin2();
	$("#notfoundLogin").css("display","none");
	$("#notfoundRegister").css("display","inherit");
	$("#notfoundLookpassword").css("display","none");
	
	$.post(ROOTPATH + "/cityJson/findAllCity.aspx", {
	}, function(data) {
		$("#notlogin-city-selecter-citys").html("");
		//这里获得城市信息
		for(var i=0;i<data.list.length;i++){
			$("#notlogin-city-selecter-citys").append('<input type="radio" name="notlogin-city-selecter-input" value="'+data.list[i].id+'"/>'+data.list[i].cityName);
		}
	});
}
function notFoundLookpassword(){
	reloadValidateCodeNotlogin3();
	$("#notfoundLogin").css("display","none");
	$("#notfoundRegister").css("display","none");
	$("#notfoundLookpassword").css("display","inherit");
}
//登录
function notFoundSubmitLogin(){
	var userName = $("#userNameNotLogin").val();
	var password = $("#passwordNotLogin").val();
	var validationCode = $("#validationCodeNotLogin").val();
	if (userName == "") {
		alert("用户名为空，请输用户名");
		return;
	}
	if (password == "") {
		alert("密码不能为空！");
		return;
	}
	if (validationCode == "") {
		alert("验证码不能为空！");
		return;
	}
	$.post(ROOTPATH + "/customer/login.aspx", {
		userName : userName,
		passWord : password,
		validationCode:validationCode
	}, function(data) {
		loginUser.successFunc(data);
	});
}
//注册
function notFoundSubmitRegister(){
	var cityId = 0;
	$('#notlogin-city-selecter-citys > input').each(function() {
		if (this.checked) {
			cityId = this.value;
		}
	});
	if (cityId == 0) {
		alert("城市没有选择,请选择城市");
		return;
	} else {
		alert(cityId);
	}
	var userName = $("#userNameRegisterNotlogin").val();
	var password = $("#passwordRegisterNotlogin").val();
	var password2 = $("#passwordRegisterNotlogin2").val();
	var email = $("#emailRegisterNotlogin").val();
	var validationCode = $("#validationCodeNotlogin2").val();
	if (userName == "") {
		alert("用户名为空，请输用户名");
		return;
	}
	if (password == "") {
		alert("密码不能为空！");
		return;
	}
	//alert(password + "=" + password2);
	if (password != password2) {
		alert("两次输入的密码不一样，请重新输入");
		return;
	}
	if (email == "") {
		alert("电子邮件不能为空，请输入电子邮件");
		return;
	}
	if(validationCode== ""){
		alert("验证码不能为空，请输入验证码");
		return;
	}
	// private String userName;
	// private String passWord;
	// private String email;
	// private int cityId;

	$.post(ROOTPATH + "/customer/registeCustomer.aspx", {
		userName : userName,
		passWord : password,
		email : email,
		cityId : cityId,
		validationCode:validationCode
	}, function(data) {
		if (data == "" || data == 0) {
			alert("<span color='red'>注册失败</span>");
		} else {
			if (data.resultCode != "1") {
				alert("注册失败，请求返回码：" + data.resultStr);
			} else {
				alert("注册成功");
				window.location.reload(true);
			}
		}
	});
}
//找回密码
function notFoundSubmitLookPassword(){
	var userName = $("#userNameLookPassword").val();
	var email = $("#emailLookPassword").val();
	var validationCode = $("#validationCodeNotlogin3").val();
	if (userName == "") {
		alert("用户名为空，请输用户名");
		return;
	}
	if (email == "") {
		alert("电子邮件不能为空，请输入电子邮件");
		return;
	}
	if(validationCode== ""){
		alert("验证码不能为空，请输入验证码");
		return;
	}
	$.post(ROOTPATH + "/customer/lookPassword.aspx", {
		userName : userName,
		email : email,
		validationCode:validationCode
	}, function(data) {
		if (data == "" || data == 0) {
			alert("<span color='red'>提交数据失败</span>");
		} else {
			if (data.resultCode != "1") {
				alert("提交失败,错误信息:" + data.resultStr);
			} else {
				alert("提交成功,请您在两小时内登录您的邮箱修改密码!");
				window.location.reload(true);
			}
		}
	});
}


$(document).ready(function () {  
	$("#validationAreaNotlogin").html("");
	$("#validationAreaNotlogin").html('<img alt="验证码" src="'+ROOTPATH+'/validateCode.aspx?a='+UUID.prototype.createUUID()+'" style="width: 60px;height: 20px; vertical-align:middle;">');
	/*$("#validationAreaNotlogin2").html("");
	$("#validationAreaNotlogin2").html('<img alt="验证码" src="'+ROOTPATH+'/validateCode.aspx?a='+UUID.prototype.createUUID()+'" style="width: 60px;height: 20px; vertical-align:middle;">');
	$("#validationAreaNotlogin3").html("");
	$("#validationAreaNotlogin3").html('<img alt="验证码" src="'+ROOTPATH+'/validateCode.aspx?a='+UUID.prototype.createUUID()+'" style="width: 60px;height: 20px; vertical-align:middle;">');*/
});

/**
	*/